package com.hxj.ecokey.controller;

import com.hxj.ecokey.entity.UserRanking;
import com.hxj.ecokey.service.RankingService;
import com.hxj.ecokey.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/api/ranking")
public class RankingController {
    @Autowired
    private RankingService rankingService;

    @GetMapping("/list")
    public  Result getRankingList(@RequestParam Integer type){
        List<UserRanking> rankings = rankingService.getRankingList((type));
        return Result.success("获取排行榜成功",rankings);
    }
}
